#ifndef SNAP_IMAGE_H
#define SNAP_IMAGE_H
#include <string>
#include <functional>
#include <osg/Camera>

struct SnapImage : public osg::Camera::DrawCallback
{
	SnapImage():
		snapImage(false)
	{
		image = new osg::Image;
	}

	void set(const std::string& filename,std::function<void(const QString&,bool)> cb)
	{
		file = filename;
		fn = cb;
	}
	
	void operator()(osg::RenderInfo& renderInfo)const;

	std::string file;
	std::function<void(const QString&,bool)> fn;
	mutable bool snapImage = false;
	mutable osg::ref_ptr<osg::Image> image;
};

#endif